public class BallsConverter {
	public String theGood(String[] convert) {
		int n = convert.length;
		int[][] t = new int[n][n];
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				char c = convert[i].charAt(j);
				if (Character.isLowerCase(c))
					t[i][j] = c - 'a' + 26;
				else
					t[i][j] = c - 'A';
			}
		}
		for (int i = 0; i < n; i++) {
			for (int j = 0; j < n; j++) {
				for (int k = 0; k < n; k++) {
					if (t[i][t[j][k]] != t[t[i][j]][k])
						return "Bad";
				}
			}
		}
		return "Good";
	}

// BEGIN CUT HERE
   public static void main(String[] args) {
		if ( args.length == 0 ) {
			BallsConverterHarness.run_test(-1);
		} else {
			for ( int i=0; i<args.length; ++i )
				BallsConverterHarness.run_test(Integer.valueOf(args[i]));
		}
	}
// END CUT HERE
}

// BEGIN CUT HERE
class BallsConverterHarness {
	public static void run_test( int casenum ) {
		if ( casenum != -1 ) {
			if ( runTestCase( casenum ) == -1 )
				System.err.println("Illegal input! Test case " + casenum + " does not exist.");
			return;
		}
		
		int correct = 0, total = 0;
		for ( int i=0;; ++i ) {
			int x = runTestCase(i);
			if ( x == -1 ) {
				if ( i >= 100 ) break;
				continue;
			}
			correct += x;
			++total;
		}
		
		if ( total == 0 ) {
			System.err.println("No test cases run.");
		} else if ( correct < total ) {
			System.err.println("Some cases FAILED (passed " + correct + " of " + total + ").");
		} else {
			System.err.println("All " + total + " tests passed!");
		}
	}
	
	static boolean compareOutput(String expected, String result) { return expected.equals(result); }
	static String formatResult(String res) {
		return String.format("\"%s\"", res);
	}
	
	static int verifyCase( int casenum, String expected, String received ) { 
		System.err.print("Example " + casenum + "... ");
		if ( compareOutput( expected, received ) ) {
			System.err.println("PASSED");
			return 1;
		} else {
			System.err.println("FAILED");
			System.err.println("    Expected: " + formatResult(expected)); 
			System.err.println("    Received: " + formatResult(received)); 
			return 0;
		}
	}

	static int runTestCase( int casenum ) {
		switch( casenum ) {
		case 0: {
			String[] convert          = {"AB", "BA"};
			String expected__         = "Good";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}
		case 1: {
			String[] convert          = {"BA", "AA"};
			String expected__         = "Bad";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}
		case 2: {
			String[] convert          = {"ACB", "CBA", "BAC"};
			String expected__         = "Bad";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}
		case 3: {
			String[] convert          = {"AAAA", "ABBB", "ABCC", "ABCD"};
			String expected__         = "Good";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}
		case 4: {
			String[] convert          = {"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcd", "ACEGIKMOQSUWYacACEGIKMOQSUWYac", "ADGJMPSVYbADGJMPSVYbADGJMPSVYb", "AEIMQUYcCGKOSWaAEIMQUYcCGKOSWa", "AFKPUZAFKPUZAFKPUZAFKPUZAFKPUZ", "AGMSYAGMSYAGMSYAGMSYAGMSYAGMSY", "AHOVcFMTaDKRYBIPWdGNUbELSZCJQX", "AIQYCKSaEMUcGOWAIQYCKSaEMUcGOW", "AJSbGPYDMVAJSbGPYDMVAJSbGPYDMV", "AKUAKUAKUAKUAKUAKUAKUAKUAKUAKU", "ALWDOZGRcJUBMXEPaHSdKVCNYFQbIT", "AMYGSAMYGSAMYGSAMYGSAMYGSAMYGS", "ANaJWFSBObKXGTCPcLYHUDQdMZIVER", "AOcMaKYIWGUESCQAOcMaKYIWGUESCQ", "APAPAPAPAPAPAPAPAPAPAPAPAPAPAP", "AQCSEUGWIYKaMcOAQCSEUGWIYKaMcO", "AREVIZMdQDUHYLcPCTGXKbOBSFWJaN", "ASGYMASGYMASGYMASGYMASGYMASGYM", "ATIbQFYNCVKdSHaPEXMBUJcRGZODWL", "AUKAUKAUKAUKAUKAUKAUKAUKAUKAUK", "AVMDYPGbSJAVMDYPGbSJAVMDYPGbSJ", "AWOGcUMEaSKCYQIAWOGcUMEaSKCYQI", "AXQJCZSLEbUNGdWPIBYRKDaTMFcVOH", "AYSMGAYSMGAYSMGAYSMGAYSMGAYSMG", "AZUPKFAZUPKFAZUPKFAZUPKFAZUPKF", "AaWSOKGCcYUQMIEAaWSOKGCcYUQMIE", "AbYVSPMJGDAbYVSPMJGDAbYVSPMJGD", "AcaYWUSQOMKIGECAcaYWUSQOMKIGEC", "AdcbaZYXWVUTSRQPONMLKJIHGFEDCB"} ;
			String expected__         = "Good";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}
		case 5: {
			String[] convert          = {"AAAAAFAAAAAAAAAAAAAAAAAXAAAAcAAAAAAAAAAnAAAAAAAvAA", "ABBBBFBBBBBLBBBBQBBBBBBXYBBBcBBBBBBBBBBnBBBBBBBvwB", "ABCCCFCCCCCLMCOCQRCCCCCXYCCCcCCCCCCCCCCnCCCCsCCvwC", "ABCDEFGHDDDLMDODQRSDUVWXYDDbcdDfghDDklDnopDrsDDvwx", "ABCEEFEEEEELMEOEQRSEUVWXYEEbcEEfEhEEklEnEpEEsEEvwE", "FFFFFFFFFFFFFFFFFFFFFFFXFFFFcFFFFFFFFFFFFFFFFFFvFF", "ABCGEFGGGGGLMGOGQRSGUVWXYGGbcGGfGhGGklGnGpGGsGGvwG", "ABCHEFGHHHHLMHOHQRSHUVWXYHHbcdHfHhHHklHnHpHHsHHvwH", "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx", "ABCDEFGHJJJLMJOJQRSJUVWXYJJbcdJfghJJklJnopJrsJJvwx", "ABCDEFGHKJKLMNOPQRSTUVWXYZKbcdefghijklmnopqrsKKvwx", "ALLLLFLLLLLLLLLLLLLLLLLXLLLLcLLLLLLLLLLnLLLLLLLvwL", "ABMMMFMMMMMLMMOMQMMMMMMXYMMMcMMMMMMMMMMnMMMMMMMvwM", "ABCDEFGHNJNLMNOPQRSTUVWXYZNbcdefghijklmnopqrsNNvwx", "ABOOOFOOOOOLOOOOQOOOOOOXYOOOcOOOOOOOOOOnOOOOOOOvwO", "ABCDEFGHPJPLMPOPQRSTUVWXYZPbcdPfghiPklmnopPrsPPvwx", "AQQQQFQQQQQLQQQQQQQQQQQXQQQQcQQQQQQQQQQnQQQQQQQvwQ", "ABRRRFRRRRRLMRORQRRRRRRXYRRRcRRRRRRRRRRnRRRRRRRvwR", "ABCSSFSSSSSLMSOSQRSSSSSXYSSScSSSSSSSSSSnSSSSsSSvwS", "ABCDEFGHTJTLMTOTQRSTUVWXYTTbcdTfghiTklTnopTrsTTvwx", "ABCUUFUUUUULMUOUQRSUUUWXYUUUcUUUUhUUklUnUUUUsUUvwU", "ABCVVFVVVVVLMVOVQRSVUVWXYVVbcVVfVhVVklVnVVVVsVVvwV", "ABCWWFWWWWWLMWOWQRSWWWWXYWWWcWWWWhWWkWWnWWWWsWWvwW", "XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXvXX", "AYYYYFYYYYYLYYYYQYYYYYYXYYYYcYYYYYYYYYYnYYYYYYYvwY", "ABCDEFGHZJZLMZOZQRSTUVWXYZZbcdZfghiZklZnopZrsZZvwx", "ABCDEFGHaJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwx", "ABCbbFbbbbbLMbObQRSbUbWXYbbbcbbfbhbbklbnbbbbsbbvwb", "cccccccccccccccccccccccXcccccccccccccccccccccccvcc", "ABCdEFGddddLMdOdQRSdUVWXYddbcddfdhddkldndpddsddvwd", "ABCDEFGHeJeLMeOPQRSTUVWXYZebcdefghijklmnoperseevwx", "ABCffFfffffLMfOfQRSfUfWXYfffcffffhffklfnffffsffvwf", "ABCgEFGHgggLMgOgQRSgUVWXYggbcdgfghggklgngpggsggvwg", "ABChhFhhhhhLMhOhQRShhhhXYhhhchhhhhhhkhhnhhhhshhvwh", "ABCDEFGHiJiLMiOiQRSiUVWXYiibcdifghiiklinopirsiivwx", "ABCDEFGHjJjLMjOPQRSTUVWXYZjbcdjfghijklmnopjrsjjvwx", "ABCkkFkkkkkLMkOkQRSkkkkXYkkkckkkkkkkkkknkkkkskkvwk", "ABCllFlllllLMlOlQRSlllWXYlllcllllhllkllnllllsllvwl", "ABCDEFGHmJmLMmOmQRSTUVWXYZmbcdmfghimklmnopmrsmmvwx", "nnnnnFnnnnnnnnnnnnnnnnnXnnnncnnnnnnnnnnnnnnnnnnvnn", "ABCoEFGHoooLMoOoQRSoUVWXYoobcdofghooklonoporsoovwx", "ABCppFpppppLMpOpQRSpUVWXYppbcppfphppklpnpppSsppvwp", "ABCDEFGHqJqLMqOPQRSTUVWXYZqbcdefghijklmnopqrsqqvwx", "ABCrEFGHrrrLMrOrQRSrUVWXYrrbcdrfghrrklrnrSrrsrrvwx", "ABsssFsssssLMsOsQRsssssXYssscssssssssssnsssssssvws", "ABCDEFGHtJKLMNOPQRSTUVWXYZtbcdefghijklmnopqrsttvwx", "ABCDEFGHuJKLMNOPQRSTUVWXYZubcdefghijklmnopqrstuvwx", "vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv", "AwwwwFwwwwwwwwwwwwwwwwwXwwwwcwwwwwwwwwwnwwwwwwwvww", "ABCxEFGHxxxLMxOxQRSxUVWXYxxbcdxfghxxklxnxpxxsxxvwx"} ;
			String expected__         = "Bad";

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}

		// custom cases

/*      case 6: {
			String[] convert          = ;
			String expected__         = ;

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}*/
/*      case 7: {
			String[] convert          = ;
			String expected__         = ;

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}*/
/*      case 8: {
			String[] convert          = ;
			String expected__         = ;

			return verifyCase( casenum, expected__, new BallsConverter().theGood( convert ) );
		}*/
		default:
			return -1;
		}
	}
}

// END CUT HERE
